Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'orEmpty' convenience function to Option #58

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

millyrowboat
Copy link
Collaborator

Clawed back from #53

  • orEmpty is a convenience function that we've been using in our codebases, that will return an empty string if your Option is None
    • Wondering now if that should only be allowed to be called on a Option context. Thoughts? As in:
fun Option<String>.orEmpty(f: (String) -> String): String = this.map(f).getOrElse { "" }

@millyrowboat millyrowboat merged commit a65ef0d into main Sep 20, 2023
2 checks passed
@millyrowboat millyrowboat deleted the milly/20230912-orempty branch September 20, 2023 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants